package com.example.yuanboot.controller.system;

import com.example.yuanboot.common.msg.BaseResultCode;
import com.example.yuanboot.common.msg.ObjectRestResponse;
import com.example.yuanboot.common.msg.ResponseUtils;
import com.example.yuanboot.model.entity.system.SysRole;
import com.example.yuanboot.service.system.ISysRoleService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 系统角色
 *
 * @author qingyan 2021-09-27
 */
@RestController
@RequestMapping("/sys/role")
@RequiredArgsConstructor
public class SysRoleController {
    private final ISysRoleService sysRoleService;

    @GetMapping("/list")
    public ObjectRestResponse<List<SysRole>> list(){
        List<SysRole> list = sysRoleService.lambdaQuery().select(SysRole::getRoleName, SysRole::getRoleCode).list();
        return ResponseUtils.r(list, BaseResultCode.SUCCESS);
    }
}
